
/*This .do file runs the estimates from 'Beyond Investment Flows: How Perceptions of Property Rights Drive the Impact of IIAs' by Jennifer L. Tobin*/


/*
	
Begin replication
*/

clear

 /*Change working directory*/
cd 
	


/* Dataset*/
use "iias_propertyrights_final.dta"



/*Appendix C: 1st stage regression*/

reg bit_enf_hcum_ln MA5_enforced democracy tradeop gdppc size_sml firm_age i.sector i.year i.country_id, robust
predict bit_enf_hcum_ln_resid, residuals

/*generate interactions*/
gen bit_resid_foreign_51=bit_enf_hcum_ln_resid*foreign_owned_51pct
label variable bit_resid_foreign_51 "=bit_enf_hcum_ln_resid*foreign_owned_51pct"

gen bit_resid_foreign_75=bit_enf_hcum_ln_resid*foreign_owned_75pct
label variable bit_resid_foreign_75 "=bit_enf_hcum_ln_resid*foreign_owned_75pct"
gen bit_resid_foreign_100=bit_enf_hcum_ln_resid*foreign_owned_100pct
label variable bit_resid_foreign_100 "=bit_enf_hcum_ln_resid*foreign_owned_100pct"


/*Appendix B: produce data for summary statistics table*/

sum propertyrights_good1 bit_enf_hcum foreign_owned_51pct foreign_owned_75pct foreign_owned_100pct democracy tradeop_std gdppc_ln polconv size_sml firm_age  i.sector  if propertyrights_good1~=. & bit_enf_hcum_ln~=. &  foreign_owned_51pct~=. &  bit_foreign_51_ln~=. &  democracy~=. &  gdppc_ln~=. &  tradeop_std~=. &  polconv~=. &  size_sml~=. &  firm_age~=. &   bit_enf_hcum_ln_resid~=. &  bit_resid_foreign_51~=. &  sector~=. &  year~=.  



/*Table 1*/

/*primary specification*/
xtmelogit propertyrights_good1 bit_enf_hcum_ln foreign_owned_51pct bit_foreign_51_ln democracy gdppc_ln tradeop_std polconv size_sml firm_age  bit_enf_hcum_ln_resid bit_resid_foreign_51 i.sector i.year || country_id:

/*without interaction*/
xtmelogit propertyrights_good1 bit_enf_hcum_ln foreign_owned_51pct  democracy gdppc_ln tradeop_std polconv  size_sml firm_age  bit_enf_hcum_ln_resid i.sector i.year || country_id:

/*without foreign investors*/
xtmelogit propertyrights_good1 bit_enf_hcum_ln  democracy gdppc_ln tradeop_std polconv size_sml firm_age  bit_enf_hcum_ln_resid i.sector i.year || country_id:



 /*additional specifications*/


/*APPENDIX D Changes to IIAs */

/* Model (1) US IIA*/
/*first stage regression*/
reg us_bit MA5_enforced democracy tradeop gdppc i.year i.country_id, robust
predict us_bit_resid, residuals
gen usbit_resid_foreign_51=us_bit_resid*foreign_owned_51pct
 

xtmelogit propertyrights_good1 i.us_bit##i.foreign_owned_51pct democracy gdppc_ln tradeop_std size_sml firm_age us_bit_resid usbit_resid_foreign_51 i.sector i.year || country_id:
estimates store model1


/* Model (2) IIAs signed with high income countries*/
/*first stage regression*/
reg bit_sign_hcum_ln MA5_enforced democracy tradeop gdppc i.year i.country_id, robust
predict bit_sign_hcumln_resid, residuals


 xtmelogit propertyrights_good1 c.bit_sign_hcum_ln##i.foreign_owned_51pct democracy gdppc_ln tradeop_std size_sml firm_age bit_sign_hcumln_resid  i.sector i.year || country_id:
estimates store model2
 

/* Model (3) all IIAs in force */
/*first stage regression*/
 
reg bit_enf_cum_ln democracy tradeop gdppc i.year i.country_id, robust
predict bit_enf_cum_resid, residuals
gen bitenf_resid_foreign_51=bit_enf_cum_resid*foreign_owned_51pct
 

xtmelogit propertyrights_good1 c.bit_enf_cum_ln##i.foreign_owned_51pct democracy gdppc_ln tradeop_std size_sml firm_age  bit_enf_cum_resid bitenf_resid_foreign_51 i.sector i.year || country_id: 
estimates store model3

 
/*Appendix E change RHS Variables*/


 /*primary specification plus FDI*/
  xtmelogit propertyrights_good1 bit_enf_hcum_ln foreign_owned_51pct bit_foreign_51_ln democracy gdppc_ln tradeop_std fdi_gdp size_sml firm_age  bit_enf_hcum_ln_resid bit_resid_foreign_51 i.sector i.year || country_id:

 
 /*primary specification polity instead of democracy*/
 
  xtmelogit propertyrights_good1 bit_enf_hcum_ln foreign_owned_51pct bit_foreign_51_ln polityfrompolity gdppc_ln tradeop_std size_sml firm_age  bit_enf_hcum_ln_resid bit_resid_foreign_51 i.sector i.year || country_id:


  /*primary specification without country-level variables*/
 xtmelogit propertyrights_good1 bit_enf_hcum_ln foreign_owned_51pct bit_foreign_51_ln size_sml firm_age  bit_enf_hcum_ln_resid bit_resid_foreign_51 i.sector i.year || country_id:

 
 
/*Appendix F increase foreign ownership %*/
 

/*75% foreign ownership*/ 
 
  xtmelogit propertyrights_good1 bit_enf_hcum_ln foreign_owned_75pct bit_foreign_75_ln democracy gdppc_ln tradeop_std polconv size_sml firm_age  bit_enf_hcum_ln_resid bit_resid_foreign_75 i.sector i.year || country_id:

  /*100% foreign ownership*/ 

 
  xtmelogit propertyrights_good1 bit_enf_hcum_ln foreign_owned_100pct bit_foreign_100_ln democracy gdppc_ln tradeop_std polconv size_sml firm_age  bit_enf_hcum_ln_resid bit_resid_foreign_100 i.sector i.year || country_id:

  /*End Replication*/
  
  
  




  
  
  